﻿using Iesi.Collections.Generic;
using Newtonsoft.Json;
using System;
using System.ComponentModel.DataAnnotations;

namespace Romantics.Domain.Objects
{
    public class Hike : NamedEntity
    {
        public virtual string Description { get; set; }

        [Required(ErrorMessage = "ShortDescription: Обязательное поле")]
        [StringLength(500, ErrorMessage = "ShortDescription: Длина не должна превышать 200 символов")]
        public virtual string ShortDescription { get; set; }

        public virtual bool Published { get; set; }
        public virtual string Route { get; set; }

        [Required(ErrorMessage = "DateTime: Обязательное поле")]
        public virtual DateTime StartDate { get; set; }


        [Required(ErrorMessage = "EndDate: Обязательное поле")]
        public virtual DateTime EndDate { get; set; }

        [JsonIgnore]
        public virtual int Duration { get; set; }

        [Required(ErrorMessage = "Category: Обязательное поле")]
        public virtual Category Category { get; set; }

        [Required(ErrorMessage = "Region: Обязательное поле")]
        public virtual Region Region { get; set; }

        public virtual string Meta { get; set; }

        private ISet<PhotoAlbum> photoAlbums = new HashedSet<PhotoAlbum>();

        [JsonIgnore]
        public virtual ISet<PhotoAlbum> PhotoAlbums
        {
            get { return photoAlbums; }
            set { photoAlbums = value; }
        }

        private ISet<Report> reports = new HashedSet<Report>();

        [JsonIgnore]
        public virtual ISet<Report> Reports
        {
            get { return reports; }
            set { reports = value; }
        }
    }
}
